<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>系统后台 - {$Think.config.INTENDANT_NAME} - by HemaCMS</title>
    <link href="__INTENDANT__/css/admin_style.css" rel="stylesheet" />
    <script src="__COMMON__/jquery.js"></script>
    <script src="__COMMON__/jquery.cookie.js"></script>
    <script src="__COMMON__/layer/layer.js"></script>
    <script src="__INTENDANT__/js/iteny.intendant.js"></script> <!-- 公共easyui JS -->
    <link href="__INTENDANT__/css/iteny.css" rel="stylesheet" />
    <style type="text/css">
    tr{border-left: 1px solid #e5e3e3;}
    td{border-right: 1px solid #e5e3e3;}
    </style>
</head>
<body>
<div class="wrap J_check_wrap">
  	<div class="nav">
	    <ul class="cc">
	        <li class="current"><a href="{:U('Site/role')}">角色管理</a></li>
	        <li><a href="{:U('Site/addRole')}">添加角色</a></li>
	    </ul>
	</div>
  	<div class="table_list">
	  	<form name="myform" action="{:U("Rbac/listorders")}" method="post">
		    <table width="100%" cellspacing="0">
		      <thead>
		        <tr>
		          <td width="20" align='center'>ID</td>
		          <td>角色名称</td>
		          <td width="200" align='center'>角色描述</td>
		          <td width="50"   align='center'>状态</td>
		          <td width="250" align='center'>管理操作</td>
		        </tr>
		      </thead>
		      <tbody>
		      	<foreach name="Userlist" item="vo">
			        <tr>
			          <td align='center'>{$vo.id}</td>
			          <td>{$vo.title}</td>
			          <td align='center'>{$vo.remark}</td>
			          <td align="center">
			          	<if condition="$vo['status'] eq 1"><font style="color:green;">√</font><else /><font  style="color:red;">X</font></if>

			          </td>
			          <td align="center">
			          	<if condition="$vo['id'] eq 1">
			          		<font color="#cccccc">权限设置</font>
			          		| <font color="#cccccc">修改</font> | <font color="#cccccc">删除</font>
			          	<else />
			          		<a href="{:U('Site/setRole','id=' . $vo["id"] .'&data=' .$vo["title"])}">权限设置</a>
			          		| <a href="{:U('Site/editRole',array('id'=>$vo['id']))}">修改</a> | <a datatitle="{$vo.title}" class="J_ajax_del" href="{:U('Site/delRole')}" data="{$vo.id}">删除</a>
			          	</if>
			          </td>
			        </tr>
		        </foreach>
		      </tbody>
		    </table>
	  	</form>
  	</div>
</div>
<script type="text/javascript">
$(function(){
	$('.J_ajax_del').on('click', function (e) {
    e.preventDefault();
    var title = $(this).attr('datatitle');
    var href = $(this).attr('href');
    var data = $(this).attr('data');
    layer.confirm('是否删除角色<span style="color:red;">['+title+']</span>', {icon: 3, title:'删除角色提示'}, function(index){


        layer.close(index);
        $.ajax({
        type: 'post',
        url: href,
        data : {id : data},
        dataType:"json",
        beforeSend: function(){
          layer.load(1);
        },
        success: function(data){
          layer.close(layer.load(1));
          if(!data.status){
            ITENY.alert('提示信息',data.info,2,'5000');

          } else {
            ITENY.alert('提示信息',data.info,1,'5000');
            setTimeout(function(){
                      ITENY.reloadPage(window);
                  },3000);

          }
        },
        error: function(data){
          layer.close(layer.load(1));
          ITENY.alert('提示信息',data.responseText,2,'5000');

        }
      });
    });
  });
});
</script>
</body>
</html>